<template>
  <el-row :gutter="20" type="flex">
    <el-col :span="6">
      <el-input placeholder="请输入名称" v-model="listQuery.name" clearable>
      </el-input
    ></el-col>
    <el-col :span="6">
      <el-button type="custom" plain @click="refreshList()">搜索</el-button>
      <el-button
        type="custom"
        @click="handleAdd()"
        v-if="activePro.length > 0 && $button(activePro[0])"
      >
        新增</el-button
      >
    </el-col>
  </el-row>
</template>
<script>
export default {
  data() {
    return {
      listQuery: {
        name: '',
        page: 1,
      },
      activePro: [],
    }
  },
  props: ['proList'],
  watch: {
    $route: {
      immediate: true,
      handler() {
        this.activePro = this.proList[this.$route.meta.labelType - 1]
      },
    },
  },
  methods: {
    refreshList() {
      this.$bus.$emit('refreshLabelList', this.listQuery)
    },
    handleAdd() {
      this.$bus.$emit('showDialogLabelAdd')
    },
  },
}
</script>